package com.douya.common.format;


import cn.hutool.json.JSONUtil;
import com.douya.common.pojo.dto.PagerDTO;
import org.springframework.format.Formatter;

import java.util.Locale;

/**
 * 说明：分页信息转化类
 *
 * @Author 胡晨烨
 * @Date 2020/02/01
 */
public class PagerDTOFormatter implements Formatter<PagerDTO> {

    @Override
    public PagerDTO parse(String text, Locale locale) {
        return JSONUtil.toBean(text, PagerDTO.class);
    }

    @Override
    public String print(PagerDTO object, Locale locale) {
        return JSONUtil.toJsonStr(object);
    }
}
